#include<bits/stdc++.h>
using namespace std;
int d=0,dg,x=1e5,xg;
bool b[1000001];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    int ans=0;
    int a[n];
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=n;i>=0;i--)
    {
        if(a[i]!=1&&b[i]!=1&&a[i]>a[i-1])
        {
            a[i]=1;
            b[i-1]=1;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]==1&&b[i]==0)
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}
